FIND_PATH(POSTGRESQL_INCLUDE_DIR pg_config.h PATH_SUFFIXES postgresql)
FIND_LIBRARY(POSTGRESQL_LIBRARY NAMES pq)

if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARY)
	set(POSTGRESQL_INCLUDE_DIRS ${POSTGRESQL_INCLUDE_DIR})
    if(WIN32)
        set(POSTGRESQL_LIBRARIES ${POSTGRESQL_LIBRARY} wsock32)
    else(WIN32)
        set(POSTGRESQL_LIBRARIES ${POSTGRESQL_LIBRARY})
    endif(WIN32)
endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARY)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PostgreSQL DEFAULT_MSG POSTGRESQL_INCLUDE_DIRS POSTGRESQL_LIBRARIES)
